Skip to content

feat: More work on Anthropic and OpenAI responses#5

Merged
tymondesigns merged 10 commits intomainfrom
feat/anthropic
Aug 14, 2025
Merged

feat: More work on Anthropic and OpenAI responses#5
tymondesigns merged 10 commits intomainfrom
feat/anthropic

Conversation

@tymondesigns
Copy link
Copy Markdown
Contributor

@tymondesigns tymondesigns commented Aug 12, 2025

This pull request introduces several enhancements and refactors to the LLM (Large Language Model) abstraction and its Anthropic driver, focusing on improved output parsing control, expanded tool calling configuration, and richer message/content handling. The changes add new configuration options, improve type safety, and enhance the flexibility of message and tool representations.

Core LLM API and Configuration Improvements:

  • Added the ability to explicitly control whether output parsing should be performed, via the new shouldParseOutput method in AbstractLLM, its contract, and the cache decorator. This allows output parsing to be disabled in pipeline contexts where parsing is handled separately. [1] [2] [3] [4]
  • Introduced StructuredOutputMode and related configuration in AbstractLLM, allowing more granular control over structured output behaviors. [1] [2]

Tool Calling Enhancements:

  • Updated tool configuration and methods (withTools, addTool, and ToolConfig) to support the allowParallelToolCalls option, enabling parallel tool calls if desired. [1] [2] [3]
  • Improved type safety in the Tool contract by requiring the schema() method to return an ObjectSchema instead of a generic Schema. [1] [2]

Message and Content Handling:

  • Enhanced message and content data structures: AssistantMessage now supports an optional id, ReasoningContent includes an id, and TextContent can be nullable and handles variable replacement more robustly. [1] [2] [3]
  • The Anthropic driver (AnthropicChat) now processes multiple content types, including reasoning, and builds richer message collections from response content. [1] [2]

Usage and Metrics:

  • Added a reasoningTokens metric to the Usage data structure for more detailed token accounting.

Workflow Improvements:

  • Added a new type-coverage job to the static analysis workflow, enforcing 100% type coverage using Pest.

@tymondesigns tymondesigns changed the title feat: Anthropic feat: More work on Anthropic and OpenAI responses Aug 14, 2025
@tymondesigns tymondesigns marked this pull request as ready for review August 14, 2025 22:15
@tymondesigns tymondesigns merged commit de62ab6 into main Aug 14, 2025
6 checks passed
@tymondesigns tymondesigns deleted the feat/anthropic branch December 29, 2025 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant